<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head th:replace="layouts::header"></head>
<body>
<nav th:replace="layouts::navbar"></nav>
<div>
    <h3>&nbsp</h3>
</div>
    <div class="container">
                                            <!-- ↓ 该user由控制层来 -->
        <form th:action="@{/comments/save}" th:object="${comment}" method="POST">
            <div>
                <p><span class="glyphicon glyphicon-comment"></span>发布评论</p>

                <p>昵称:<input type="text" id="tbCommentAuthor" class="author" disabled="disabled" size="50"></p>
                <p>
                    <!--                    <input type="text" style="width: 500px" name="" class="author" id="tbCommentAuthor" disabled="disabled" cols="60" rows="10" placeholder="评论内容" th:field="${comment.commenter}"></input>-->
                    <textarea name="" id="username" cols="60" rows="1" placeholder="名字" th:field="${comment.commenter}"></textarea>
                </p>

                <p>时间:</p>
                <p>
                    <input id="nowtime" cols="60" rows="1" style="width: 400px" th:field="${comment.comment_time}">
                </p>
                <script th:inline="javascript">
                    Date.prototype.format = function (fmt) {
                        var o = {
                            "M+": this.getMonth() + 1, //月份
                            "d+": this.getDate(), //日
                            "h+": this.getHours(), //小时
                            "m+": this.getMinutes(), //分
                            "s+": this.getSeconds(), //秒
                            "q+": Math.floor((this.getMonth() + 3) / 3), //季度
                            "S": this.getMilliseconds() //毫秒
                        };
                        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
                        for (var k in o)
                            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
                        return fmt;
                    }
                    var day = new Date();
                    document.getElementById("nowtime").value =day.format("yyyy-MM-dd hh:mm:ss");
                </script>

                <p>
                    <textarea style="border:solid 1px #f00; border-radius:10px; resize:none;" name="" id="id_comment" cols="60" rows="10" placeholder="评论内容" th:field="${comment.comment_info}"></textarea>
                </p>
                <p>
                    <a class="btn btn-primary btn-sm mb-3"><button type="submit">新增评论</button></a>
                </p>
            </div>

        </form>
    </div>

</body>

</html>